package com.zxl.study.entities;

import lombok.Getter;
import tk.mybatis.mapper.annotation.KeySql;

import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Table;

import java.util.Date;

import static tk.mybatis.mapper.code.ORDER.BEFORE;

@Getter
@Table(name = "cache_invalidations")
public class CacheInvalidations {
    @Id
    @Column(name = "ID")
    @KeySql(sql = "SELECT nextval('cache_invalidations_id_seq')", order = BEFORE)
    private Integer id;

    @Column(name = "TABLE_NAME")
    private String tableName;

    @Column(name = "OPERATION_TYPE")
    private String operationType;

    @Column(name = "RECORD_ID")
    private int recordId;

    @Column(name = "IS_PROCESS")
    private Boolean isProcess;

    @Column(name = "FAIL_COUNT")
    private Integer failCount;

    @Column(name = "CREATE_TIME")
    private Date createTime;

    @Column(name = "UPDATE_TIME")
    private Date updateTime;

    public CacheInvalidations setId(Integer id) {
        this.id = id;
        return this;
    }

    public CacheInvalidations setTableName(String tableName) {
        this.tableName = tableName;
        return this;

    }

    public CacheInvalidations setOperationType(String operationType) {
        this.operationType = operationType;
        return this;

    }

    public CacheInvalidations setRecordId(int recordId) {
        this.recordId = recordId;
        return this;

    }

    public CacheInvalidations setIsProcess(Boolean process) {
        isProcess = process;
        return this;

    }

    public CacheInvalidations setFailCount(Integer failCount) {
        this.failCount = failCount;
        return this;

    }

    public CacheInvalidations setCreateTime(Date createTime) {
        this.createTime = createTime;
        return this;

    }

    public CacheInvalidations setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
        return this;

    }
}
